import java.util.ArrayList;


	abstract class member {
		private boolean admin;	// set every member administrator or not
		private int ID;    //give every member a memberID
		private int userID;
		
		abstract boolean addNewMember(int userID, boolean admin,int ID);
		abstract void remove(int memberID);
		
		protected boolean getadmin(){
			return admin;
		}

		protected void setadmin(boolean admin){
			this.admin = admin;
		}

		protected void setID(int ID){
			this.ID = ID;
			
		}
		protected int getID(){
			return ID;
		}
		protected void setuserID(int userID){
			this.userID = userID;
			
		}
		protected int getuserID(){
			return userID;
		}
		
		
	}

	abstract class memberEditor {
		private ArrayList<member> memberList = new ArrayList<member>(); // an arrayList to store members
		private static int ID;
		boolean addNewMember(int userID, boolean admin){
			try {
				//System.out.println("add member : " + userID);
				/*
				 * and do something else here
				 */
				member doc = addmember();
				doc.addNewMember(userID,admin,ID);
				memberList.add(doc);
			}
			catch (Exception e) {
				System.out.println("fail adding : " + userID);
				return false;
			}
			return true;
		}
		void remove(int memberID){
			int nowIndex = -1, removeIndex = -1;  
			
			for(member doc : memberList) {
				nowIndex++;
				if(doc.getID() == memberID); {  
					removeIndex = nowIndex;
				}
			}	
			
			if(removeIndex > -1) {  
			    memberList.remove(removeIndex);
			    System.out.println("delete member of : " + memberID +" succeed");
			}
			else {
				System.out.println("delete " + memberID + " label failed");
			}
		}
		void getAllmember(){
	    	for(member doc : memberList) {
	    		System.out.println("member =  " + doc.getuserID());
	        }
	    }
		int getNumOfMember(){
			return memberList.size();
		}
		protected member getMember(int memberId){
			for(member doc : memberList) {
	    		if ( doc.getID() == memberId )
	    			return doc;
	        }
			return null;
		}
		protected ArrayList<member> getAll(){
			if (memberList.size() == 0){
				return null;
			}
			return memberList;
		}
		abstract member addmember();
	}

	class memberInfor extends memberEditor {
		member addmember (){
			return new member () {
				boolean addNewMember(int userID, boolean admin,int ID){ 
					this.setID(ID);
					this.setuserID(userID);
					this.setadmin(admin);
					return true; 
				}
				void remove(int memberID){
					System.out.println("delete member of : " + memberID +" succeed");
				}			
				
			};
		}
	}	